home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / network / ncsasock / s_types.h < prev    next >
Text File  |  1996-07-05  |  3KB  |  105 lines

  1. /*
  2.  * Copyright (c) 1982 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  *
  6.  *    @(#)types.h    7.11 (Berkeley) 6/25/90
  7.  */
  8.  
  9. #ifndef _TYPES_
  10. #define    _TYPES_
  11.  
  12. #if !defined(_NCBI_) && !defined(Int4)
  13. #define Int4 long
  14. #endif
  15.  
  16. typedef    short    dev_t;
  17. #ifndef _POSIX_SOURCE
  18.                     /* major part of a device */
  19. #define    major(x)    ((int)(((unsigned)(x)>>8)&0377))
  20.                     /* minor part of a device */
  21. #define    minor(x)    ((int)((x)&0377))
  22.                     /* make a device number */
  23. #define    makedev(x,y)    ((dev_t)(((x)<<8) | (y)))
  24. #endif
  25.  
  26. typedef    unsigned char    u_char;
  27. typedef    unsigned short    u_short;
  28. typedef    unsigned int    u_int;
  29. typedef    unsigned long    u_long;
  30. typedef    unsigned short    ushort;        /* Sys V compatibility */
  31.  
  32. #ifdef KERNEL
  33. #include "machine/machtypes.h"
  34. #else
  35. #include <ma_types.h>
  36. #endif
  37.  
  38. #ifdef    _CLOCK_T_
  39. typedef    _CLOCK_T_    clock_t;
  40. #undef    _CLOCK_T_
  41. #endif
  42.  
  43. #ifdef    _TIME_T_
  44. typedef    _TIME_T_    time_t;
  45. #undef    _TIME_T_
  46. #endif
  47.  
  48. #ifdef    _SIZE_T_
  49. #if !defined(COMP_THINKC) && !defined(COMP_CODEWAR)
  50. typedef    _SIZE_T_    size_t;
  51. #endif
  52. #undef    _SIZE_T_
  53. #endif
  54.  
  55. #ifndef _POSIX_SOURCE
  56. typedef    struct    _uquad { unsigned long val[2]; } u_quad;
  57. typedef    struct    _quad { long val[2]; } quad;
  58. #endif
  59. typedef    long *    qaddr_t;    /* should be typedef quad * qaddr_t; */
  60.  
  61. typedef    long    daddr_t;
  62. typedef    char *    caddr_t;
  63. typedef    u_long    ino_t;
  64. typedef    long    swblk_t;
  65. typedef    long    segsz_t;
  66. typedef    long    off_t;
  67. typedef    u_short    uid_t;
  68. typedef    u_short    gid_t;
  69. typedef    short    pid_t;
  70. typedef    u_short    nlink_t;
  71. typedef    u_short    mode_t;
  72. typedef u_long    fixpt_t;
  73.  
  74. #ifndef _POSIX_SOURCE
  75. #define    NBBY    8        /* number of bits in a byte */
  76.  
  77. /*
  78.  * Select uses bit masks of file descriptors in longs.  These macros
  79.  * manipulate such bit fields (the filesystem macros use chars).
  80.  * FD_SETSIZE may be defined by the user, but the default here should
  81.  * be >= NOFILE (param.h).
  82.  */
  83. #ifndef    FD_SETSIZE
  84. #define    FD_SETSIZE    256
  85. #endif
  86.  
  87. typedef long    fd_mask;
  88. #define NFDBITS    (sizeof(fd_mask) * NBBY)    /* bits per mask */
  89.  
  90. #ifndef howmany
  91. #define    howmany(x, y)    (((x)+((y)-1))/(y))
  92. #endif
  93.  
  94. typedef    struct fd_set {
  95.     fd_mask    fds_bits[howmany(FD_SETSIZE, NFDBITS)];
  96. } fd_set;
  97.  
  98. #define    FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
  99. #define    FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
  100. #define    FD_ISSET(n, p)    ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
  101. #define    FD_ZERO(p)    bzero((char *)(p), sizeof(*(p)))
  102.  
  103. #endif /* !_POSIX_SOURCE */
  104. #endif /* _TYPES_ */
  105.